package com.controller.lyxmcontroller.controller.articleList;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.service.lyxmserviceapi.model.ArticleModel;
import com.service.lyxmserviceapi.model.Module;
import com.service.lyxmserviceapi.service.aritcle.ArticleList;
import com.service.lyxmserviceapi.service.index.IndexService;
import com.service.lyxmserviceapi.service.module.ModuleService;

@Controller
public class ArticleListController {

	@Autowired
	private ArticleList articleListImpl;
	@Autowired
	private ModuleService moduleService;
	@Autowired
	private IndexService indexServiceImpl;
	
	@RequestMapping( value = "/getArticleList/{moduleId}",method = RequestMethod.GET)
	public String getArticleListByModuleId(@PathVariable("moduleId") String moduleId,Model model,HttpServletResponse response,HttpServletRequest request){
		List<ArticleModel> articleModelList = articleListImpl.getArticleListByModuleId(moduleId);
		model.addAttribute("articleList",articleModelList);
		
		//获取首页模块列表
		List<Module> moduleList = indexServiceImpl.getIndexModule();
		model.addAttribute("moduleList",moduleList);
		
		
		
		
		return "/articleList/articleList";
	}
	
	
	
	
}
